# coding: utf-8
from django.shortcuts import render
# from django.http import HttpResponse
from .models import *


def index(request):
    categories = Categories.objects.all()
    return render(request, 'blog/index.html', {'categories': categories})


def categories_detail(request, category_slug):
    category = Categories.objects.get(slug=category_slug)
    return render(request, 'blog/category.html', {'category': category})


def article_detail(request, pk):
    article = Article.objects.get(pk=pk)
    return render(request, 'blog/article.html', {'article': article})
